package com.map.struct.service;

import com.map.struct.pojo.UserBO;
import com.map.struct.pojo.UserDO;
import com.map.struct.pojo.UserDetailBO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * 用户转换
 *
 * @author Amadeus
 * @date 2023/10/08
 */
@Mapper(componentModel = "lombok")
public interface UserConvert {

    UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);

    /**
     * 转换
     *
     * @param userDO 用户do
     * @return {@link UserBO}
     */
    UserBO convert(UserDO userDO);

    /**
     * 转换详细信息
     *
     * @param userDO 用户do
     * @return {@link UserDetailBO}
     */
    @Mapping(target = "userId", source = "id")
    UserDetailBO convertDetail(UserDO userDO);

}
